#pragma once
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>
#define GetValue(arr, i, j)     ((arr).at<double>((i),(j)))
#define SetValue(arr, i, j, v)  ((arr).at<double>((i),(j))=(v))


#define GetValue_U(arr, i, j)     ((arr).at<uchar>((i),(j)))
#define SetValue_U(arr, i, j, v)  ((arr).at<uchar>((i),(j))=(v))

#define SAMPLE_NUM 500
using namespace cv;
class Affine
{
public:
	Affine(void);
	// parameters[0]          thi
	// parameters[1]          phi
	// parameters[2]          scale
	// parameters[3]          skew
	// parameters[4]          x
	// parameters[5]          y
	Mat parameters;
	Mat P;
	static Affine *RandAffine;
	static double std[6];
public:
	~Affine(void);

	void GetAffParameters(CvPoint2D32f *location, CvSize templateSize);
	void MatrixTransform();
	void GetMatrixFromParameters();
	void RandomParameters();
	void PrintMatrix(Mat matrix);
	void PrintMatrix1(Mat matrix);
	void RandomData();
	void Assign(const Affine & matchAffine);
	void GenerateSample(Mat &sampledata, IplImage *img, CvSize templateSize);
	void DrawBox(CvSize templateSize, IplImage *img , CvScalar color, int thickness);
};
